<?php

namespace Fendx;

trait Singleton
{
    public static $instance = null;

    /**
     * @return self
     */
    public static function getInstance()
    {
        if (!is_null(self::$instance) && is_object(self::$instance))
        {
            return self::$instance;
        }
        $class          = get_called_class();
        self::$instance = new $class;

        return self::$instance;
    }
}
